package com.tdkj.model.user;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.website.BeanWebsiteNotice;

/**
 * XnkyAdmin entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "xnky_admin")
public class BeanAdmin extends BaseEntity {

	private static final long serialVersionUID = -6295464907736926042L;
	private String adminname;
	private String adminpassword;
	private String adminLoginName;
	private Timestamp logintime;
	private String state;// 正常,冻结
	private BeanAdminLevel adminLevel;
	private int superAdmin;
	private Set<BeanWebsiteNotice> websiteNotices = new HashSet<BeanWebsiteNotice>(0);
	private Set<BeanAdminSilvercoin> adminSilvercoins = new HashSet<BeanAdminSilvercoin>(0);
	private Set<BeanAdminLog> adminLogs = new HashSet<BeanAdminLog>(0);

	// Constructors

	/** default constructor */
	public BeanAdmin() {
	}

	/** minimal constructor */
	public BeanAdmin(long id, Timestamp logintime) {
		this.setId(id);
		this.logintime = logintime;
	}

	/** full constructor */
	public BeanAdmin(long id, String adminname, String adminpassword, Timestamp logintime, BeanAdminLevel adminLevel, Set<BeanWebsiteNotice> websiteNotices, Set<BeanAdminSilvercoin> adminSilvercoins, Set<BeanAdminLog> adminLogs) {
		this.setId(id);
		this.adminname = adminname;
		this.adminpassword = adminpassword;
		this.logintime = logintime;
		this.websiteNotices = websiteNotices;
		this.adminSilvercoins = adminSilvercoins;
		this.adminLevel = adminLevel;
		this.adminLogs = adminLogs;
	}

	// Property accessors

	@Column(name = "adminname", length = 40)
	public String getAdminname() {
		return this.adminname;
	}

	public void setAdminname(String adminname) {
		this.adminname = adminname;
	}

	@Column(name = "adminpassword", length = 40)
	public String getAdminpassword() {
		return this.adminpassword;
	}

	public void setAdminpassword(String adminpassword) {
		this.adminpassword = adminpassword;
	}

	@Column(name = "state", length = 40)
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "logintime", length = 19)
	public Timestamp getLogintime() {
		return this.logintime;
	}

	public void setLogintime(Timestamp logintime) {
		this.logintime = logintime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "admin")
	public Set<BeanAdminSilvercoin> getAdminSilvercoins() {
		return this.adminSilvercoins;
	}

	public void setAdminSilvercoins(Set<BeanAdminSilvercoin> websiteNotices) {
		this.adminSilvercoins = websiteNotices;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "admin")
	public Set<BeanWebsiteNotice> getWebsiteNotices() {
		return this.websiteNotices;
	}

	public void setWebsiteNotices(Set<BeanWebsiteNotice> websiteNotices) {
		this.websiteNotices = websiteNotices;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "admin")
	public Set<BeanAdminLog> getAdminLogs() {
		return this.adminLogs;
	}

	public void setAdminLogs(Set<BeanAdminLog> adminLogs) {
		this.adminLogs = adminLogs;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "adminlevelid")
	public BeanAdminLevel getAdminLevel() {
		return this.adminLevel;
	}

	public void setAdminLevel(BeanAdminLevel adminLevel) {
		this.adminLevel = adminLevel;
	}

	public String getAdminLoginName() {
		return adminLoginName;
	}

	public void setAdminLoginName(String adminLoginName) {
		this.adminLoginName = adminLoginName;
	}

	public int getSuperAdmin() {
		return superAdmin;
	}

	public void setSuperAdmin(int superAdmin) {
		this.superAdmin = superAdmin;
	}

}